home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / IFC_112 / netscape / application / GraphicsState.java < prev    next >
Encoding:
Text File  |  1999-05-28  |  1.9 KB  |  73 lines  |  [TEXT/CWIE]

  1. // GraphicsState.java
  2. // By Ned Etcode
  3. // Copyright 1996, 1997 Netscape Communications Corp.  All rights reserved.
  4.  
  5. package netscape.application;
  6.  
  7. import netscape.util.*;
  8.  
  9. class GraphicsState implements Cloneable {
  10.     java.awt.Graphics   awtGraphics;
  11.     Font                font;
  12.     Color               color;
  13.     Rect                clipRect;
  14.     Rect                absoluteClipRect;
  15.     int                 xOffset;
  16.     int                 yOffset;
  17.     Color               xorColor;
  18.     int                 debugOptions;
  19.  
  20.     /* These are duplicated from DebugGraphics so that the class doesn't
  21.        need to be brought in. */
  22.     static final int     LOG_OPTION      = 1 << 0;
  23.     static final int     FLASH_OPTION    = 1 << 1;
  24.     static final int     BUFFERED_OPTION = 1 << 2;
  25.     static final int     NONE_OPTION     = -1;
  26.  
  27.  
  28.     public Object clone() {
  29.         GraphicsState newState = null;
  30.  
  31.         try {
  32.             newState = (GraphicsState) super.clone();
  33.         } catch (Exception e) {
  34.         }
  35.  
  36.         if (newState != null) {
  37.             newState.clipRect = null;
  38.             newState.absoluteClipRect = null;
  39.             newState.awtGraphics = null;
  40.         }
  41.  
  42.         return newState;
  43.     }
  44.  
  45.     public String toString() {
  46.         StringBuffer buf;
  47.  
  48.         buf = new StringBuffer();
  49.  
  50.         buf.append("Font: " + font + ", ");
  51.         buf.append("Color: " + color + ", ");
  52.         buf.append("Translation: (" + xOffset + ", " + yOffset + "), ");
  53.         buf.append("xor: " + xorColor + ", ");
  54.         buf.append("absoluteClipRect: " + absoluteClipRect + ", ");
  55.         buf.append("debugOption: " + debugOptions);
  56.  
  57.         return buf.toString();
  58.     }
  59.  
  60.     boolean debugLog() {
  61.         return (debugOptions & LOG_OPTION) == LOG_OPTION;
  62.     }
  63.  
  64.     boolean debugFlash() {
  65.         return (debugOptions & FLASH_OPTION) == FLASH_OPTION;
  66.     }
  67.  
  68.     boolean debugBuffered() {
  69.         return (debugOptions & BUFFERED_OPTION) == BUFFERED_OPTION;
  70.     }
  71.  
  72. }
  73.